<template>
  <!-- 已选课题 -->
  <div>
    <div class="head"></div>
    <div class="content">
      <el-table :data="topic" style="width: 100%">
        <el-table-column prop="name" label="课题名称" width="180">
        </el-table-column>
        <el-table-column prop="from" label="课题来源" width="180">
        </el-table-column>
        <el-table-column prop="type" label="课题类型"> </el-table-column>
        <el-table-column prop="status" label="审核状态"> </el-table-column>
        <el-table-column prop="teacher_name" label="指导老师">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
export default {
  created() {
    this.getTopic();
    // this.getTeacher();
  },
  data() {
    return {
      topic: [
        {
          name: "",
          from: "",
          type: "",
          status: "",
          teacher_name: "",
        },
      ],
    };
  },
  methods: {
    // 获取个人已选课题信息
    getTopic() {
      this.$http.get("http://127.0.0.1:8080/my/getTopic").then((res) => {
        if (res.data.status == 0) {
          if (res.data.data[1][0].topic_status == 0) {
            this.topic[0].status = "待审核";
          } else {
            this.topic[0].status = "已确认";
          }
          this.topic[0].type = res.data.data[1][0].topic_type;
          this.topic[0].name = res.data.data[1][0].topic_name;
          this.topic[0].from = res.data.data[1][0].topic_from;
          this.topic[0].teacher_name = res.data.data[0][0].teacher_name;
        } else {
          this.topic = [];
        }
      });
    },
  },
};
</script>
<style lang="less" scoped>
</style>
